package com.taotao.portal.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.taotao.pojo.ItemDesc;
import com.taotao.portal.ext.bean.Item;
import com.taotao.portal.service.ItemService;
@RequestMapping("item")
@Controller
public class ItemController {

	@Autowired
	private ItemService service;
	
	@RequestMapping(value="{itemId}", method=RequestMethod.GET)
	public ModelAndView queryItemById(@PathVariable("itemId")Long itemId){
		ModelAndView mv = new ModelAndView("item");
		
		Item item = service.queryItemById(itemId);
		mv.addObject("item", item);
		
		ItemDesc itemDesc = service.queryDescByItemId(itemId);
		mv.addObject("itemDesc", itemDesc);
		
		String itemParam = service.queryParamByItemId(itemId);
		mv.addObject("itemDesc", itemParam);
		return mv;
	}
	
}
